1. Field of the Invention
The present invention relates to an image processing apparatus and an image processing method in which encoding is performed in image processing in order to compress the amount of data for such purposes as reducing memory resources and increasing processing speed.
2. Description of the Related Art
Some of the conventional encoding methods for image compression involve dividing an image into predetermined rectangular areas (referred to as compression rectangular areas or unit rectangular areas) and encoding the image on a rectangular area basis. Further, Japanese Patent Laid-Open No. 2008-042687 proposes a method for achieving a high compression rate in such compression processing. In the proposed method, a resolution conversion unit performs resolution conversion to reduce the resolution of an image, which is then subjected to lossy encoding.
When such a method is used to print image data that contains objects varying in resolution, the image data is first expanded into image data having a print resolution. Then the expanded image data is converted into low-resolution image data as necessary (this is referred to as resolution compression). As such, objects having a resolution that differs from the print resolution are subjected to two resolution conversion processes.
Here, the resolution conversion from a low resolution to a high resolution can be implemented by, for example, using interpolation processing to generate interpolation pixels to be inserted between pixels. Exemplary interpolation processing includes a method in which original pixels are replicated and set as interpolation pixels, and a method in which linear interpolation is performed for original pixels. On the other hand, in the resolution conversion from a high resolution to a low resolution, pixels are removed and thinned out. One resolution compression method generates interpolation data based on the removed pixels and adds the interpolation data to resolution-converted image data in order to allow reversible (i.e., lossless) resolution compression and decompression. When resolution-compressed image data according to this method is decompressed, even the removed pixels can be recovered to their original states by referring to the interpolation data. Exemplary interpolation data may be data indicating the arrangement of differences between a representative value (a representative color) and values of the removed pixels. As another example, the interpolation data may include a bitmap of difference values to indicate that no difference value is included in the bitmap for a pixel with a difference of zero, thereby reducing the data amount of the interpolation data. It is to be understood that, besides a bitmap, there are methods for omitting data corresponding to pixels whose difference from the representative color is zero.
When such resolution conversion is performed to convert image data to high-resolution image data, pixels added for interpolation (interpolation pixels) have color components close to a pixel (an original pixel) on which the interpolation pixels are based. Particularly, in an image interpolated according to the interpolation method of simple replication of an original pixel, the original pixel and interpolation pixels have the same color components. Therefore, in the process of performing the resolution conversion again to reduce the resolution for areas that consist of an original pixel and interpolation pixels, the amount of the interpolation data is reduced and a high compression rate can be achieved.
However, if a pixel area that consists of an original pixel and interpolation pixels obtained by interpolating the original pixel extends across more than one compression rectangular area, discontinuity in color occurs between pixels in the compression rectangular areas. This reduces the compression rate compared to a compression rate that could be achieved for the interpolated image data. In other words, if the boundary of a compression rectangular area is located within a pixel area that consists of an original pixel and interpolation pixels obtained by interpolating the original pixel, the compression rate is reduced.